/*
 * Copyright 2013-2019 Xia Jun(3979434@qq.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************************************
 *                                                                                     *
 *                        Website : http://www.farsunset.com                           *
 *                                                                                     *
 ***************************************************************************************
 */
package com.workcell.workdata.im.entity;

import com.workcell.workdata.im.constant.MessageAction;
import com.workcell.workdata.im.constant.MessageFormat;
import com.workcell.workdata.im.constant.MessageState;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;

@MappedSuperclass
public abstract class Message implements Serializable {

	@Id
	@Column(name = "id")
	protected Long id = System.currentTimeMillis();

	/**
	 * @see MessageAction
	 */
	@Column(name = "action",length = 6 , nullable = false)
	protected String action;

	@Column(name = "content", length = 3200)
	protected String content;

	/**
	 * @see MessageState
	 */
	@Column(name = "state", length = 2,nullable = false)
	protected Byte state = MessageState.STATE_NOT_RECEIVED;

	/**
	 * @see MessageFormat
	 */
	@Column(name = "format", length = 2)
	protected Byte format = MessageFormat.TEXT;

	@Column(name = "create_time", updatable = false)
	protected Date createTime = new Date();

	public String getTitle(){
		return null;
	}

	public void setTitle(String title) {
	}

	public String getExtra() {
		return null;
	}

	public void setExtra(String extra) {
	}

	public abstract Long getSender();

	public abstract void setSender(Long sender) ;

	public abstract Long getReceiver();

	public abstract void setReceiver(Long receiver);

	public Byte getState() {
		return state;
	}

	public void setState(Byte state) {
		this.state = state;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Byte getFormat() {
		return format;
	}

	public void setFormat(Byte format) {
		this.format = format;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
}
